<template>
  <div style=" width :50%;margin: auto;">
    <el-upload  class="upload-demo"
                drag
                :on-change="handleChange"
                action="https://jsonplaceholder.typicode.com/posts/"
                multiple>
      <i class="el-icon-upload"></i>
      <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
      <div class="el-upload__tip" slot="tip">只能上传pdf文件，且不超过5mb</div>
    </el-upload>
  </div>
</template>
<script>
export default {
  data() {
    return {
      fileList: [
        // {name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}
      ]
    };
  },
  methods: {
    handleChange(file, fileLists) {
      console.log(fileLists);
       this.$axios({
         url: "/",
         method: "get",
         params:{
           "name":fileLists[0].name,
         }        })
         .then((res) => {
           if(res.data.flag==true){
           }
           // router.push('./adminhome')
          })
         .catch((err) => {
           console.log(err);
         });
       this.timer = setTimeout(()=>{   //设置延迟执行
                 console.log('ok');
         this.$router.push("/project")
       },15000);
    },
  }
}
</script>
